<template>
	<view>
		<u-tabbar 
			:xuanzhuanImg="xuanzhuanImg"
			:list="list" 
			:a="close" 
			mid-button-size="70"
			:mid-button="true"
			:before-switch="beforeSwitch">
		</u-tabbar>
		
		
		<!--多功能键-->
		<u-modal v-model="multi_show" :show-title="false" negative-bottom="-500" :mask-close-able="true" :show-confirm-button="false">
			<view style="margin:20px 0px 0px 30px;font-size: 16px;color: #0051BA;font-weight: bold;">多功能键</view>
			<view class="multiClass" >
				<u-grid :col="3">
					<block v-if="user.privilege.PrivilegeAddStore==1">
						<u-grid-item @click="Jump(0)">
							<u-icon :name="cdnurl+'yunwei-chuangjianmendian.png'" :size="40"></u-icon>
							<view class="grid-text">创建门店</view>
						</u-grid-item>
					</block>
					<block v-if="user.privilege.PrivilegeBindingDevice==1">
						<u-grid-item @click="Jump(1)">
							<u-icon :name="cdnurl+'ywd-gzt-saoma.png'" :size="40"></u-icon>
							<view class="grid-text">扫码运维</view>
						</u-grid-item>
					</block>
					<block v-if="user.user_type==1">
						<u-grid-item @click="Jump(2)">
							<u-icon :name="cdnurl+'ywd-dingdanhaochaxun.png'" :size="40"></u-icon>
							<view class="grid-text">订单号查询</view>
						</u-grid-item>
					</block>
					<block v-if="user.user_type==1">
						<u-grid-item @click="Jump(3)">
							<u-icon :name="cdnurl+'ywd-tousuchuli2.png'" :size="40"></u-icon>
							<view class="grid-text">投诉单查询</view>
						</u-grid-item>
					</block>
				</u-grid>
			</view>
		</u-modal>
		
		<u-toast ref="uToast" />
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				xuanzhuanImg	: false ,
				user	: uni.getStorageSync('user'),
				multi_show	: false ,
				background: {
					backgroundImage: 'linear-gradient(45deg, #0051BA, #8a8a8a)'
				},
				backtextstyle: {
					color: '#fff'
				},
				list: [{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '首页',
						pagePath: "/pages/index/index_home"
					},
					{
						// iconPath: "https://cdn.uviewui.com/uview/common/min_button.png",
						iconPath: "https://www.congzhu.com/xgxc_image/ywd-jiahao.png",
						selectedIconPath: "https://cdn.uviewui.com/uview/common/min_button_select.png",
						midButton: true,
						customIcon: false,
					},
					{
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '我的', 
						pagePath: "/my/my-home/index"
					},
				],
			}
		},
		// 接受外部参数
		props: {
			config: {
				type: Array,
				default(){
					return [];
				}
			}
		},
		computed: {
			// 底部导航数字
			// close() {
			// 	// 工作台数量记录
			// 	for( let i=0;i<this.config.length;i++ ){
			// 		this.list[i].count = this.config[i].count
			// 	}
			// },
		},
		methods: {
			Jump(state){
				// 添加门店
				if(state==0)
				{
					this.navigateTo('/pages-workbench/workbench/add_store');
				}
				// 调起相机
				if(state==1)
				{
					this.scanCode();
				}
				// 订单号查询
				if(state==2)
				{
					this.navigateTo('/pages-workbench/workbench/order_query') ;
				}
				// 投诉单查询
				if(state==3)
				{
					this.navigateTo('/pages-workbench/workbench/complaint') ;
				}
			},
			beforeSwitch(e){
				// 首页
				if(e==0){
					uni.switchTab({
						url: '/pages/index/index_home'
					})
				}
				//  多功能键
				if(e==1){
					// this.xuanzhuanImg = true
					// this.multi_show = true
					// setTimeout(()=> {
					// 	this.xuanzhuanImg = false
					// 	return false
					// }, 500);
					
					this.$refs.uToast.show({
						title: '功能开发中,敬请期待',
						type: 'success',
					})
					return false
				}
				if(e==2){
					uni.switchTab({
						url: '/my/my-home/index'
					})
				}
			},
		},
	}
</script>

<style scoped lang="scss">
	.grid-text {
			font-size: 21rpx;
			margin-top: 8rpx;
			color: $u-type-info;
		}
	.multiClass{
		width:100%;
		padding:30px 30px 30px 30px;
	}
</style>
